#!/usr/bin/python3
# -*- coding: utf-8; tab-width: 4; indent-tabs-mode: t -*-


class WrtNameServer:

    def __init__(self):
        self._requesterList = []
        self._nameServerDict = dict()

    def dispose(self):
        assert len(self._requesterList) == 0

    def add_requester(self, requester_id):
        assert requester_id not in self._requesterList

    def remove_requester(self, requester_id):
        # remove all pending request
        self._requesterList.remove(requester_id)

    def add_name_server(self, name_server_id, data):
        assert name_server_id not in self._nameServerDict
        self._nameServerDict[name_server_id] = data

    def remove_name_server(self, name_server_id):
        del self._nameServerDict[name_server_id]

    def request(self, requester_id, data, callback):
        assert requester_id in self._requesterList


